New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: make client port configurable through environment variable #352
Conversation
da69e66
to
8cdc713
Compare
package.json
Outdated
@@ -75,7 +75,7 @@ | |||
}, | |||
"scripts": { | |||
"ui-assets": "copy-aragon-ui-assets -n aragon-ui ./build", | |||
"start": "npm run ui-assets && parcel serve src/index.html --port 3000 --out-dir ./build --no-cache", | |||
"start": "npm run ui-assets && parcel serve src/index.html --port $ARAGON_CLIENT_PORT || 3000 --out-dir ./build --no-cache", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As @izqui pointed out offline, this expression doesn't actually work in Bash. Only test when $ARAGON_CLIENT_PORT
was set.
Will update.
8cdc713
to
9dd898c
Compare
Bash makes it really hard to read and repetitive as well.. Another way to go about this is using something like if-env. Let me know if you want me to give this a spin. |
Maybe we could move the |
Oh yea, totally. I like that |
9dd898c
to
52fa04b
Compare
It looks like For future reference though, parameter substitution might've been nicer in the script (could just use |
scripts/start.sh
Outdated
@@ -0,0 +1,8 @@ | |||
#!/usr/bin/env bash | |||
|
|||
if [[ ${ARAGON_CLIENT_PORT} ]]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if we should add a REACT_APP
prefix, given that all the other env vars use it.
Alternatively, we could change all the other env vars to not use that prefix since we don't need it anymore after moving to parcel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if we should add a REACT_APP prefix, given that all the other env vars use it.
I don't have super strong feelings about it, just that I think that bit of information, whether it's a react app or not, is not really necessary in that env variable.
But I'm happy to change it regardless.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, on a second thought, I have to say I probably should've stayed consistent with how env variables have been named in the past. I didn't know REACT_APP_*
vars were related to the wrapper client.
Ha, that's awesome! Thanks for pointing this out. I guess I'll convert this script to node then and update the PR |
52fa04b
to
30d03f2
Compare
Alright, this is done. PTAL and let me know if you want to change the env variable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️ Looking good!
scripts/start.js
Outdated
@@ -0,0 +1,7 @@ | |||
const execute = require('child_process').execSync |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add the #!/usr/bin/env node
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, this is already a JS file and executed with node
so I don't think this is needed. Unless, of course, you say you want this executable as a plain text file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be nice to include that as an option, in case someone ever does want to.
I'd find it weird to have to use node scripts/start.js
rather than just scripts/start.js
directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah sure. I thought this was rather a thing to do when you do indeed have a plain text file (without .js extension). I'll update it :)
scripts/start.js
Outdated
@@ -0,0 +1,7 @@ | |||
const execute = require('child_process').execSync | |||
|
|||
const clientPort = process.env.ARAGON_CLIENT_PORT || 3000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think for now it's easiest to stay consistent and use the REACT_APP
prefix, and then we can wholesale remove it from both this repo and aragon-cli in one go after.
Thanks for the review @sohkai ! I'll update this. |
30d03f2
to
228d329
Compare
This commit also moves the npm start script into scripts/start for better readability and maintainability.
228d329
to
25211a5
Compare
@sohkai updated it once more. Notice that I've also dropped the Let me know if you want to keep the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Good to merge @bpierre? |
@izqui I wonder how the |
Happy to see this landed! @bpierre I haven't tested this on Windows, but I also couldn't find any active issues on |
@PascalPrecht Cool! No it’s just that I’m not very familiar with the Windows CLI: I know Unix path separators are accepted, but I was wondering if |
Got it. I guess this needs to be tested then. |
No description provided.